﻿<fundamentals:OfficeWindow x:Class="Daytimer.WikiQuoteHelper.QuotesManager"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:fundamentals="clr-namespace:Daytimer.Fundamentals;assembly=Daytimer.Fundamentals"
		xmlns:common="WikiquoteScreensaverLib.Common" xmlns:local="clr-namespace:Daytimer.WikiQuoteHelper"
		Title="Quotes Manager" Height="300" Width="500" WindowStartupLocation="CenterOwner" ShowInTaskbar="False">
	<Grid Margin="20">
		<Grid.ColumnDefinitions>
			<ColumnDefinition />
			<ColumnDefinition Width="Auto" />
			<ColumnDefinition Width="Auto" />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<TextBlock IsHitTestVisible="False" TextWrapping="Wrap" Grid.ColumnSpan="3"
				Text="Choose what you want to see in your daily feed." />
		<fundamentals:PlaceholderTextBox x:Name="topicBox" Grid.Row="1" PlaceholderText="Add new topic" Height="23"
				Margin="0,10,0,0" Grid.ColumnSpan="3" PreviewKeyDown="topicBox_PreviewKeyDown" />
		<ListBox x:Name="listBox" Grid.Row="2" BorderThickness="0" Margin="0,10" Grid.ColumnSpan="3"
				ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto">
			<ListBox.Resources>
				<local:DateTimeConverter x:Key="DateTimeConverter" />
				<Style TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItemStyle}">
					<Setter Property="HorizontalContentAlignment" Value="Stretch" />
				</Style>
			</ListBox.Resources>
			<ListBox.ItemTemplate>
				<DataTemplate DataType="common:QuotePage">
					<Grid Background="Transparent">
						<Grid.RowDefinitions>
							<RowDefinition />
							<RowDefinition Height="Auto" />
							<RowDefinition Height="Auto" />
						</Grid.RowDefinitions>
						<TextBlock Text="{Binding Topic}" FontSize="14" TextWrapping="Wrap" IsHitTestVisible="False" />
						<TextBlock Text="{Binding Count, StringFormat='Number of quotes: {0}'}" TextWrapping="Wrap"
								Margin="0,4,0,0" Grid.Row="1" IsHitTestVisible="False" />
						<TextBlock
								Text="{Binding LastUpdate, Converter={StaticResource DateTimeConverter}, StringFormat='Last update: {0}'}"
								TextWrapping="Wrap" Margin="0,4,0,0" Grid.Row="2" IsHitTestVisible="False" />
						<Button x:Name="delete" Opacity="0" HorizontalAlignment="Right" VerticalAlignment="Top"
								MinWidth="0" Width="NaN" Height="NaN" ToolTip="Remove this topic from your feed"
								Click="delete_Click">
							<Button.Template>
								<ControlTemplate TargetType="Button">
									<Border Background="Transparent">
										<Path x:Name="path" HorizontalAlignment="Center" VerticalAlignment="Center"
												Data="M -0.5 0.75 8.5 9.5 M 0 9.25 8.5 0.5" SnapsToDevicePixels="True"
												RenderOptions.EdgeMode="Aliased" StrokeThickness="2" Opacity="0.74"
												IsHitTestVisible="False" Stroke="Black" />
									</Border>
									<ControlTemplate.Triggers>
										<Trigger Property="IsMouseOver" Value="True">
											<Setter Property="Opacity" TargetName="path" Value="1" />
										</Trigger>
									</ControlTemplate.Triggers>
								</ControlTemplate>
							</Button.Template>
						</Button>
					</Grid>
					<DataTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="Opacity" TargetName="delete" Value="1" />
						</Trigger>
					</DataTemplate.Triggers>
				</DataTemplate>
			</ListBox.ItemTemplate>
		</ListBox>
		<Button x:Name="okButton" Grid.Row="3" Grid.Column="1" Content="_OK" Width="75" Height="25" Margin="0,0,10,0"
				IsDefault="True" Click="okButton_Click" />
		<Button Grid.Row="3" Grid.Column="2" Content="_Cancel" Width="75" Height="25" IsCancel="True" />
	</Grid>
</fundamentals:OfficeWindow>
